package com.monkey.core;

import com.monkey.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * desc:
 * auth: chenxiaobin
 * data: 2018/1/3.
 */
@Component
public class MyApplicationRunner implements ApplicationRunner {
    private static Logger logger = LoggerFactory.getLogger(MyApplicationRunner.class);

    @Resource
    private AdminService adminService = null;

    @Resource
    private UserService userService = null;

    @Resource
    private MonkeyService monkeyService = null;

    @Resource
    private MarketService marketService = null;

    @Resource
    private MarryService marryService = null;

    @Resource
    private LuckService luckService = null;

    @Resource
    private BonusService bonusService = null;

    @Resource
    private TaskService taskService = null;

    @Override
    public void run(ApplicationArguments applicationArguments) {
        logger.info("----------------------init start----------------------");
        try {
            adminService.init();
            logger.info("admin service success");
            userService.init();
            logger.info("user service success");
            monkeyService.init();
            logger.info("monkey service success");
            marketService.init();
            logger.info("market service success");
            marryService.init();
            logger.info("marry service success");
            bonusService.init();
            logger.info("luck service success");
            luckService.init();
            logger.info("bonus service success");
            taskService.init();
            logger.info("task service success");
        } catch (Exception e) {
            logger.info("start error:{}", e);
        }
        logger.info("----------------------init end----------------------");
    }
}
